home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / access / chgprn.zip / CHGPRN.TXT
Text File  |  1993-01-26  |  2KB  |  53 lines

  1. ' Shown below is some sample code you can use to change certain printer settings.  
  2. ' This code is intended as an example and is not supported by Microsoft.
  3.  
  4. Type zwtDevModeStr
  5.     rgb As String * 64
  6. End Type
  7.  
  8. Type zwtDeviceMode
  9.     dmDeviceName As String * 32
  10.     dmSpecVersion As Integer
  11.     dmDriverVersion As Integer
  12.     dmSize As Integer
  13.     dmDriverExtra As Integer
  14.     dmFields As Long
  15.     dmOrientation As Integer
  16.     dmPaperSize As Integer
  17.     dmPaperLength As Integer
  18.     dmPaperWidth As Integer
  19.     dmScale As Integer
  20.     dmCopies As Integer
  21.     dmDefaultSource As Integer
  22.     dmPrintQuality As Integer
  23.     dmColor As Integer
  24.     dmDuplex As Integer
  25. End Type
  26.  
  27. '   The routine reads the current printer device mode information for the szReport
  28. '   ('PrtDevMode' property) in to DevMode structure and overwrites the PaperSize field
  29. '   with the user defined paper size. The routine sets the width of the paper
  30. '   to the Label Width, and length of the paper to the one label height.
  31. '   the routine called only for the dot matrix mailing labels, and will work
  32. '   only if dot matrix printer setup as default printer.
  33. '
  34. Private Sub DotMxSetup (szReport As String)
  35.     Dim dm As zwtDevModeStr
  36.     Dim DevMode As zwtDeviceMode
  37.  
  38. Const psUserDefined = 256  ' User defined PaperSize
  39. Const mmInInch = 254       ' mm in one inch
  40. Const dxExtra = 360
  41. Const dmAllFields = 26127  ' all fileds has been initialized
  42.  
  43.     If Not IsNull(Reports(szReport).PrtDevMode) Then
  44.     dm.rgb = Reports(szReport).PrtDevMode   ' read default device mode
  45.     LSet DevMode = dm
  46.     DevMode.dmFields = dmAllFields
  47.     DevMode.dmPaperSize = psUserDefined
  48.     DevMode.dmPaperLength = ((ptLabelSize.y + dxdySpace.y) / zwcTwipsInch) * mmInInch
  49.     DevMode.dmPaperWidth = (((ptLabelSize.x + dxdySpace.x) * cItemsAcross + xLeftMargin + xRightMargin) / zwcTwipsInch) * mmInInch
  50.     LSet dm = DevMode
  51.     Reports(szReport).PrtDevMode = dm.rgb   ' write new device mode
  52.     End If
  53. End Sub